package com.xiaoyu.test;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

/**
 * ${DESCRIPTION}
 *
 * @author muxiaoyu
 * @create 2017/05/08 13:22
 **/
public class List2Json {
    private static final ObjectMapper MAPPER = new ObjectMapper();

    @Test
    public void test01() throws Exception {
        List<Integer> list = new ArrayList<Integer>();
        for (int i = 0; i < 10; i++) {
            list.add(i);
        }
        String s = MAPPER.writeValueAsString(list);
        System.out.println(s);
        List ll = MAPPER.readValue(s, List.class);
        System.out.println(ll);
    }
}
